package cn.gzsendi.itmp.itmpanalysisserver

import org.apache.spark.{SparkConf, SparkContext}

/**
  * 单词行数计算
  */
object SimpleApp {

  def main(args: Array[String]): Unit = {
    val logFile = "data/wordcount.txt" // Should be some file on your system
    val conf = new SparkConf().setMaster("local[6]").setAppName("Simple Application")
    val sc = new SparkContext(conf)
    val rdd1 = sc.textFile(logFile, 2).cache()
    val numAs = rdd1.filter(line => line.contains("a")).count()
    val numBs = rdd1.filter(line => line.contains("b")).count()
    println("Lines with a: %s, Lines with b: %s".format(numAs, numBs))
  }

}
